package com.lsfb.signsys.login;

import com.lsfb.signsys.compatible.ExceptionEngine;
import com.lsfb.signsys.HttpUtils;
import com.lsfb.signsys.compatible.Token;

import java.util.HashMap;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;

import static com.lsfb.signsys.HttpUtils.result;

/**
 * Created by zgscwjm on 2018/3/26.
 * model 层
 */
public class LoginRepository {


    private final LoginDataSource loginDataSource;


    public LoginRepository() {
        this.loginDataSource = HttpUtils.getService(LoginDataSource.class);
    }

    public Observable<LoginBean> login(LoginTO loginTO) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("username", loginTO.getUsername());
        hashMap.put("password", loginTO.getPassword());
        hashMap.put("jpushid", loginTO.getJpushid());
        hashMap.put("deviceid", loginTO.getDeviceid());
        return result(loginDataSource.login(hashMap));
    }




}
